
// teste do yam com a instrução LW

package main

import (
  "ygo"
  "fmt"
)


func main() {

	load := make(chan int32)
	instruction_address := make(chan uint32)
	instruction := make(chan uint32)//, 2)
	end := make(chan uint32)
	ls_addr := make(chan uint32)
	ls_rw := make(chan bool)
	ls_data_in := make(chan int32)
	ls_data_out := make(chan int32)



	go ygo.Memory(load, instruction_address, instruction, ls_addr, ls_rw, ls_data_in, ls_data_out)
	go ygo.Yam(instruction_address,instruction, ls_addr, ls_rw, ls_data_in, ls_data_out)

	fmt.Println("[TB ] Sending data to memory")

//	for i:=0; i<4096; i++{
// 		load <- 0x8c220000 //L: lw  r2,0(r1)
// 	}
	teste := uint32(0xAD020000)
	for i:=0; i<5; i++{
		load <- int32(teste) //L: lw  r2,0(r1)
	}
	
	load <- 0 //
	load <- 0 //
	load <- 0 //
	load <- 0 //
	load <- 0 //
	load <- 8 //
	load <- 9 //
	load <- 10 //
	load <- 11 //
	load <- 12 //
	load <- 13 //

	fmt.Println("[TB ] Closing memory")
	close(load)

	fmt.Println("[TB ] Infinite loop")
	for {
		<- end
	} 

}
